#include "d3dApp.h"
#include "ObjReader.h"
#include "DrawableTex2D.h"
#include "Light.h"

class ContentManager;
class Level;
class GraphCamera;
class Sphere;
class PhysX;
class TrianglePosColor;
class QuadPosColor;
class Character;
class Weapon;
class SkyBox;
class FullscreenQuad;
class Terrain;
class RenderContext;
class FullScreenPostProcess;
class Tornado;
class Cube;

class TestGameApp : public D3DApp
{
public:
	TestGameApp(HINSTANCE hInstance);
	~TestGameApp();

	virtual void InitApp();
	virtual void OnResize();
	virtual void UpdateScene(const InputState & m_pInputState);
	virtual void DrawScene();
	void LoadObjMesh(IniFile* config, wstring loc);
	virtual void KeyPressed(WPARAM key);
private:
	void ResetRenderTargets();
	void drawSceneToShadowMap();
	
	//Shadow mapping parts
	ID3D10EffectMatrixVariable* mfxBuildShadowMapLightWVPVar;
	ID3D10EffectShaderResourceVariable* mfxBuildShadowMapDiffuseMapVar;
	ID3D10ShaderResourceView* mFloorMapRV;
	ID3D10EffectShaderResourceVariable* mfxDrawShadowMapTexVar;
	ID3D10EffectShaderResourceVariable* mfxShadowMapVar;

	ID3D10EffectTechnique* mBuildShadowMapTech;
	ID3D10EffectTechnique* mDrawShadowMapTech;
	ID3D10Effect* BuildShadowMapFX;
	ID3D10Effect* DrawShadowMapFX;
	ID3D10Effect* ShadowFX;

	DrawableTex2D* mShadowMap;

	D3DXMATRIX mLightView;
	D3DXVECTOR3 mLightPos; //Deze kan geanimeert worden
	D3DXMATRIX mLightVolume;
	//End shadow mapping parts
	PhysX *m_pPhysX;
	Level *m_pLevel;
	GraphCamera *m_pGraphCamera;
	GraphCamera *m_pOrthoCamera;
	Character* m_pCharacter;
	Sphere *m_pSphere;
	TrianglePosColor* m_pTrianglePosColor;
	QuadPosColor* m_pQuadPosColor;
	float m_Angle;
	Light m_DirLight;
	Weapon* m_Weapon;
	SkyBox* m_SkyBoxPtr;
	FullscreenQuad* m_FullScreenQuad;
	FullScreenPostProcess* m_PostPorcessQuad;
	DrawableTex2D* m_PostProcess;
	Terrain* m_pTerrain;
	Tornado* m_Tornado;
	Cube* m_Cube;
	D3DXVECTOR3 test;

	float AnglePitch, AngleUp;
};